package org.spdata.tsdb.client;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 查询条件
 */
public class Query {
	/**
	 * 起始时间
	 */
	private Date start;
	/**
	 * 截止时间
	 */
	private Date end;
	
	private DownSample sample;
	private List<SubQuery> subQueries = new ArrayList<SubQuery>();	
	private Aggregate aggregate = null;
	
	public static Query newInstance(){
		return new Query();
	}

	public Query addSubQuery(SubQuery query){
		this.subQueries.add(query);
		return this;
	}

	public Date getStart() {
		return start;
	}
	
	public Query setStart(Date start) {
		this.start = start;
		return this;
	}

	public Date getEnd() {
		return end;
	}

	public Query setEnd(Date end) {
		this.end = end;
		return this;
	}


	public DownSample getSample() {
		return sample;
	}


	public Query setSample(DownSample sample) {
		this.sample = sample;
		return this;
	}


	public List<SubQuery> getSubQueries() {
		return subQueries;
	}


	public Query setSubQueries(List<SubQuery> subQueries) {
		this.subQueries = subQueries;
		return this;
	}


	public Aggregate getAggregate() {
		return aggregate;
	}


	public Query setAggregate(Aggregate aggregate) {
		this.aggregate = aggregate;
		return this;
	}
	
}
